package com.ni.learning.exam.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.our.learning.infrastructure.po.Exam;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @author : Ice'Clean
 * @date : 2023-06-07
 */
@Mapper
public interface ExamMapper extends BaseMapper<Exam> {

    /**
     * 查询教师负责的所有考试
     * @param teacherId 教师 ID
     * @return 负责的考试列表
     */
    @Select("select exam.id, name, paper_id, course_id, checked, startTime, endTime, create_time " +
            "from t_exam exam " +
            "join t_course_teacher on teacher_id = #{teacherId} " +
            "on exam.id = map.exam_id" +
            "where teacher_id = #{teacherId}" +
            "")
    List<Exam> teacherExamList(@Param("teacherId") int teacherId);
}
